import { Controller, Post, Body, UseGuards } from '@nestjs/common';
import { IntegralService } from './integral.service';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { GetUser } from '../auth/decorators/get-user.decorator';

@Controller('integral')
@UseGuards(JwtAuthGuard) // 使用JWT守卫
export class IntegralController {
  constructor(private readonly integralService: IntegralService) {}

  @Post('addIntegralLog')
  async addIntegralLog(
    @Body() data: { integralAddType: string },
    @GetUser() user: { email: string },
  ) {
    return this.integralService.addIntegralLog({
      integralAddType: data.integralAddType,
      userEmail: user.email,
    });
  }
} 